package com.test.bean;

/**
 * 定义一个员工的状态枚举 希望数据库保存的是100 200 300 这些状态码
 * 
 * @author huyong
 *
 */
public enum SalgradeStatus {
	LOGIN(100, "用户登录"), LOGOUT(200, "用户登出"), REMOVE(300, "用户不存在");
	private Integer code;
	private String msg;

	private SalgradeStatus(Integer code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	// 按照状态码返回一个枚举对象
	public static SalgradeStatus getSalgradeStatus(Integer code) {
		switch (code) {
		case 100:
			return LOGIN;
		case 200:
			return LOGOUT;
		case 300:
			return REMOVE;
		default:
			return LOGOUT;
		}
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

}
